package com.spsy.order.controller;

import com.alibaba.fastjson2.JSON;
import com.mysql.cj.x.protobuf.MysqlxCrud;
import com.spsy.api.common.NotifyOrderVo;
import com.spsy.api.order.OrderApi;
import com.spsy.common.core.domain.R;
import com.spsy.order.domain.Order;
import com.spsy.order.service.IOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class OrderOpsApiController implements OrderApi {
    @Autowired
    private IOrderService orderService;


    @Override
    public R createOrder(NotifyOrderVo vo) {
        log.info("notify:{}", JSON.toJSONString(vo));

        int i = orderService.updateOrderById(Order.builder().orderStatus(vo.getStatus()).orderNo(vo.getOrderId()).build());
        log.info("i:{}",i);
        return R.ok();
    }
}
